package com.scientificInfo.dao;

import com.scientificInfo.bean.LoginCount;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface LoginCountMapper {

    @Select("SELECT* FROM logincount ORDER BY loginCount DESC LIMIT 5")
    List<LoginCount> selectAll();

    @Select("select* from logincount where userId = #{loginCount.userId}")
    LoginCount selectOne(@Param("loginCount") LoginCount loginCount);

    @Update("update logincount set loginCount = #{count} where userId = #{loginCount.userId} ")
    int updateOne(@Param("loginCount") LoginCount loginCount, @Param("count") Integer count);

    @Insert("insert into logincount (userId, loginCount) values ( #{loginCount.userId}, #{count})")
    int insertOne(@Param("loginCount") LoginCount loginCount, @Param("count") Integer count);
}
